<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue.directive</title>
    <script type="text/javascript" src="../assets/js/vue.js"></script>
</head>
<body>
    <h1>vue.directive</h1>
    <hr>
    <div id="app">
       <div v-jspang="color">{{num}}</div> 
       <p><button @click="add">add</button></p>
    </div>
    <script type="text/javascript">
       Vue.directive("jspang",{
        bind: function(el,binding){
            el.style="color:"+binding.value;
        },
        inserted: function() {

        },
        update:function (){

        },
        componentUpdated:function(){

        },
        unbind:function(){

        }
          
       });
       //
       var app = new Vue({
        el:'#app',
        data:{
            num: 10,
            color: 'red'
        },
        methods:{
            add:function(){
                  this.num++;
            }
        }
       })
    </script>
</body>
</html>